package test9;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class  ConcurrentHashMapDemo2 {
    public static void main(String[] args) throws Exception {
        Map<String, String> map = new ConcurrentHashMap<String, String>();    // Map集合
        for (int num = 0; num < 10; num++) {    // 循环定义线程
            new Thread(() -> {
                for (int x = 0; x < 10; x++) {    // 循环存储数据
                    map.put("【" + Thread.currentThread().getName() + "】x = " + x, "www.yootk.com"); // 集合数据存储
                    System.out.println(map);    // 集合输出
                }
            }, "Map集合操作线程 - " + num).start();    // 启动子线程
        }
    }
}